
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Customizing Web DataWindow generation</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="dwprgugp46.htm">Previous</A>&nbsp;&nbsp;<A HREF="dwprgugp48.htm" >Next</A>
<!-- End Header -->
<A NAME="BABBFBDE"></A><h1>Customizing Web DataWindow generation</h1>
<A NAME="TI1775"></A><p>You can customize the XHTML that is generated at runtime by
the XML Web DataWindow and the XHTML Web DataWindow using an XHTML
export template in the DataWindow painter's Export Template
view for XHTML.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>XML and XHTML Web DataWindow customization</span> <A NAME="TI1776"></A>This section focuses on customizing the XHTML generated by
the XML Web DataWindow.</p>
<A NAME="TI1777"></A><h2>The Export Template view for XHTML</h2>
<A NAME="TI1778"></A><p>Each DataWindow object that you create has a default XHTML
export template associated with it. You can see the default template
in the DataWindow painter's Export Template view for XHTML.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Displaying the XHTML export template</span> <A NAME="TI1779"></A>The Export Template view for XHTML coexists with the Export
Template view for XML, each on its own tab page with XML on the
top by default. To display the view for XHTML, click the XHTML tab.
If you have any problems displaying the view, select View&gt;Export/Import
Template&gt;XHTML from the menu bar or select View&gt;Layouts&gt;Default
and then click the XHTML tab.</p>
<A NAME="TI1780"></A><p>The XHTML export template is a single-instance document of
the &lt;form&gt; element. It stores only the structural
layout and any changes that you make to the elements, attributes,
and style declarations. When XHTML or XSLT is generated, these changes
are incorporated into the &lt;form&gt; element and the CSS
stylesheet used to render the DataWindow in the browser. More than
one export template can be created for a DataWindow.</p>
<A NAME="TI1781"></A><p>Default style rules and most default attributes are not stored
in the template. Any changes to style declarations are stored in
the template, but at runtime they are removed and applied to the
separately generated CSS stylesheet.</p>
<A NAME="TI1782"></A><p>In the Export Template view for XHTML, you can reference DataWindow column,
computed field, and text controls, and DataWindow expressions for each
row in the XHTML, wherever character data is allowed. At runtime,
these are replaced with text.</p>
<A NAME="TI1783"></A><h2>What you can customize</h2>
<A NAME="TI1784"></A><p>The XML Web DataWindow generates DataWindow content, layout,
and style separately at runtime and renders in the browser a fully-functional DataWindow
in XHTML.</p>
<br><img src="images/xmlxslt.gif">
<A NAME="TI1785"></A><p>At design time, you can customize each of these XML Web DataWindow components:<A NAME="TI1786"></A>
<ul>
<li class=fi>Elements or contents of the &lt;form&gt; element</li>
<li class=ds>CSS stylesheet declarations</li>
<li class=ds>Other XHTML element-specific attributes (including
style attributes) in the DataWindow form</li>
<li class=ds>JavaScript event handlers
</li>
</ul>
</p>
<A NAME="TI1787"></A><h4>Examples of customization</h4>
<A NAME="TI1788"></A><p>Your customizations can include these types of modifications:</p>
<A NAME="TI1789"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><th  rowspan="1"  ><A NAME="TI1790"></A>Customization</th>
<th  rowspan="1"  ><A NAME="TI1791"></A>Example</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1792"></A>Structural layout</td>
<td  rowspan="1"  ><A NAME="TI1793"></A>Add or remove elements and content (input
fields of the XHTML &lt;form&gt; element) from the header, detail,
summary, and footer bands</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1794"></A>Style rules of data input field elements
in the &lt;form&gt; element</td>
<td  rowspan="1"  ><A NAME="TI1795"></A>Modify the default CSS stylesheet property
values and add or remove CSS stylesheet declarations</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1796"></A>Other attributes of elements of the DataWindow</td>
<td  rowspan="1"  ><A NAME="TI1797"></A>Override attribute values and remove
or add attributes specific to these elements</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1798"></A>JavaScript event handlers</td>
<td  rowspan="1"  ><A NAME="TI1799"></A>Override, redirect, add, or remove JavaScript event
handlers</td>
</tr>
</table>
<A NAME="TI1800"></A><h2>The default XHTML export template</h2>
<A NAME="TI1801"></A><p>In the default XHTML export template, export XHTML entities
(markup and character data) are displayed as single tree view items
that denote the type of entity. The default template has one element
for each column in the DataWindow object: </p>
<br><img src="images/xhtmldm2.gif">
<A NAME="TI1802"></A><p>You can create multiple templates and save them by name with
the DataWindow object. Each template is uniquely associated with
the DataWindow object open in the painter. For information, see <A HREF="dwprgugp47.htm#CEGIGECA">"Managing templates"</A>.</p>
<A NAME="TI1803"></A><h4>How tree view items are represented</h4>
<A NAME="TI1804"></A><p>Each
item in the XHTML export template displays as a single tree view
item with an image and font color that denotes its type. Elements
are represented by a yellow icon that resembles a luggage tag. The
end tags of elements and the markup delimiters (angle brackets)
used in an XHTML document do not display.</p>
<A NAME="TI1805"></A><p><A HREF="dwprgugp47.htm#CIHCHEJJ">Table 6-10</A> shows
the icons used in the Export Template view for XHTML.</p>
<A NAME="CIHCHEJJ"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 6-10: Icons used in the Export Template view for XHTML</caption>
<tr><th  rowspan="1"  ><A NAME="TI1806"></A>Icon</th>
<th  rowspan="1"  ><A NAME="TI1807"></A>Description</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1808"></A><br><img src="images/icotag.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1809"></A>Root or child element</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1810"></A><br><img src="images/icogrp.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1811"></A>Group header element</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1812"></A><br><img src="images/icodw.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1813"></A>DataWindow column reference</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1814"></A><br><img src="images/icotext.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1815"></A>Static text control reference</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1816"></A><br><img src="images/icoexp.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1817"></A>Computed field or DataWindow expression
reference</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1818"></A><br><img src="images/icolit.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1819"></A>Literal text</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1820"></A><br><img src="images/icocdata.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1821"></A>CDATA section</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1822"></A><br><img src="images/iconest.gif">
</td>
<td  rowspan="1"  ><A NAME="TI1823"></A>Nested report</td>
</tr>
</table>
<A NAME="CEGIGECA"></A><h2>Managing templates</h2>
<A NAME="TI1824"></A><p>From
the pop-up menu for the default XHTML export template (with no items selected),
you can create multiple templates and save them by name with the DataWindow
object open in the painter. You can also open and edit existing templates
that are associated with the current DataWindow object and, when more
than one template is associated with the DataWindow, delete the
current template:</p>
<br><img src="images/extpopup.gif">
<A NAME="TI1825"></A><p>The pop-up menu has these options for managing templates:</p>
<A NAME="TI1826"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><th  rowspan="1"  ><A NAME="TI1827"></A>Menu item</th>
<th  rowspan="1"  ><A NAME="TI1828"></A>Description</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1829"></A>New Default</td>
<td  rowspan="1"  ><A NAME="TI1830"></A>Define a new default XHTML export template
based on the current DataWindow layout</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1831"></A>Open</td>
<td  rowspan="1"  ><A NAME="TI1832"></A>Open a saved template</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1833"></A>Save</td>
<td  rowspan="1"  ><A NAME="TI1834"></A>Save the current template; if the template
has no name, name it</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1835"></A>Save As</td>
<td  rowspan="1"  ><A NAME="TI1836"></A>Save the current template with a new
name</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1837"></A>Delete</td>
<td  rowspan="1"  ><A NAME="TI1838"></A>Delete the current template (enabled
only if more than one template exists for the current DataWindow
object)</td>
</tr>
</table>
<A NAME="CHDBIFAA"></A><h3>Creating and saving templates</h3>
<A NAME="TI1839"></A><h4>Creating a new default template</h4>
<A NAME="TI1840"></A><p>To create a new default XHTML export template, select New
Default from the pop-up menu in the Export Template view for XHTML. </p>
<br><img src="images/newdeflt.gif">
<A NAME="TI1841"></A><p>A new default XHTML export template has the following elements:</p>
<A NAME="TI1842"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><th  rowspan="1"  ><A NAME="TI1843"></A>Elements</th>
<th  rowspan="1"  ><A NAME="TI1844"></A>Name defaults to</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1845"></A>Root &lt;form&gt;</td>
<td  rowspan="1"  ><A NAME="TI1846"></A><i>DataWindow name</i>_dataForm</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1847"></A>Header &lt;div&gt;</td>
<td  rowspan="1"  ><A NAME="TI1848"></A><i>DataWindow name</i>_band1</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1849"></A>Detail &lt;div&gt;</td>
<td  rowspan="1"  ><A NAME="TI1850"></A><i>DataWindow name</i>_band<i>n</i></td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1851"></A>Summary &lt;div&gt;</td>
<td  rowspan="1"  ><A NAME="TI1852"></A><i>DataWindow name</i>_band<i>n</i></td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1853"></A>Footer &lt;div&gt;</td>
<td  rowspan="1"  ><A NAME="TI1854"></A><i>DataWindow name</i>_band<i>n</i></td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1855"></A>Child elements of the Header, Detail, Summary,
and Footer elements</td>
<td  rowspan="1"  ><A NAME="TI1856"></A>Name of each DataWindow control.</td>
</tr>
</table>
<A NAME="TI1857"></A><h4>Saving the template</h4>
<A NAME="TI1858"></A><p>To save
a new default template, select Save from the pop-up menu in the Export
Template view for XHTML, name the template, and provide a comment that
identifies its use. </p>
<br><img src="images/tmpsav1.gif">
<A NAME="TI1859"></A><p>The template is stored inside the DataWindow object in the <ACRONYM title = "pibble" >PBL</ACRONYM>. After saving a template with
a DataWindow object, you can see its definition in the Source editor
for the DataWindow object. For example, this is part of the source
for a DataWindow that has two templates. The templates have required
elements only:<p><PRE> export.xhtml(usetemplate = "t_phone"<br>template = (name = "t_address" <br>        comment = "Employee Address Book" xhtml = "&lt;...&gt;")<br>template = (name = "t_phone" <br>        comment = "Employee Phone Book" xhtml = "&lt;...&gt;") )</PRE></p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Defining multiple templates</span> <A NAME="TI1860"></A>You can define multiple templates for a single DataWindow
object. One reason you might do this is to vary the edit styles
generated for the same DataWindow edit control.</p>
<A NAME="TI1861"></A><h3>Selecting the template to use</h3>
<A NAME="TI1862"></A><h4>Using the Export.XHTML.<br>UseTemplate
property</h4>
<A NAME="TI1863"></A><p>The Data Export page in the Properties view lets you set properties
for exporting data in XHTML. The names of all templates that you
create and save for the current DataWindow object display in the
Use Template drop-down list. </p>
<A NAME="TI1864"></A><p>In addition to the properties that you can set on this page,
you can use the Export.XHTML.TemplateCount and Export.XHTML.Template[ ].Name properties
to let the user of an application select an export template at runtime. See <A HREF="dwprgugp47.htm#CIHJJHCH">"Selecting XHTML export templates
at runtime"</A>.</p>
<A NAME="TI1865"></A><p>You can specify the template you want to apply to the default
XML Web DataWindow or XHTML Web DataWindow generation at runtime
by setting the Export.XHTML.UseTemplate property. You set the property
using the Data Export tab in the DataWindow painter's Properties
view by selecting XHTML as the format and then selecting the XHTML
export template's name from the Use Template drop-down
list box.</p>
<br><img src="images/dataexpt.gif">
<A NAME="TI1866"></A><p>You can also set the Export.XHTML.UseTemplate DataWindow property
in script. For information, see <A HREF="dwprgugp47.htm#CIHJJHCH">"Selecting XHTML export templates
at runtime"</A>.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Incorrect setting of the UseTemplate property</span> <A NAME="TI1867"></A>If you set the Export.XHTML.UseTemplate property at runtime
to the name of a template that does not exist, the built-in default
Template is used on an export.</p>
<A NAME="TI1868"></A><h4>Properties related to XHTML export templates</h4>
<A NAME="TI1869"></A><p><A HREF="dwprgugp47.htm#CEGEEJDG">Table 6-11</A> shows
properties related to XHTML export templates.</p>
<A NAME="CEGEEJDG"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 6-11: Properties for XHTML export templates</caption>
<tr><th  rowspan="1"  ><A NAME="TI1870"></A>Property</th>
<th  rowspan="1"  ><A NAME="TI1871"></A>User interface fields</th>
<th  rowspan="1"  ><A NAME="TI1872"></A>Description</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1873"></A>Export.XHTML.<br>TemplateCount</td>
<td  rowspan="1"  ><A NAME="TI1874"></A>Read only, so no user interface field.</td>
<td  rowspan="1"  ><A NAME="TI1875"></A>The number of XHTML export templates
associated with a DataWindow object</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1876"></A>Export.XHTML.<br>Template[num].<br>Name</td>
<td  rowspan="1"  ><A NAME="TI1877"></A>Read only, so no user interface field.</td>
<td  rowspan="1"  ><A NAME="TI1878"></A>The name of an XHTML export template
associated with a DataWindow object returned by index value that
ranges from 1 to the value of the Export.XHTML.TemplateCount property</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1879"></A>Export.XHTML.<br>UseTemplate</td>
<td  rowspan="1"  ><A NAME="TI1880"></A>Select a template from the Use Template drop-down
list box in the Data Export tab in the DataWindow painter's
Properties view.</td>
<td  rowspan="1"  ><A NAME="TI1881"></A>The name of an XHTML export template
(previously saved in the DataWindow painter) that optionally controls
the logical structure of the XHTML generated by a DataWindow object</td>
</tr>
</table>
<A NAME="TI1882"></A><p>For detailed information about DataWindow properties, see
the <i>DataWindow Reference</i>
.</p>
<A NAME="TI1883"></A><h2>Template structure</h2>
<A NAME="TI1884"></A><p>An XHTML export template has a Header section and a Detail
section separated graphically by a line across the tree view. Other
DataWindow bands are incorporated into these sections.</p>
<br><img src="images/exptemp3.gif">
<A NAME="CIHBCBFI"></A><h4>The Detail Start element</h4>
<A NAME="TI1885"></A><p>A
line across the Export/Import Template view separates the
Header section from the Detail section. The first element after
this line, d_dept_list_row in the previous
screen shot, is called the Detail Start element. </p>
<A NAME="TI1886"></A><p>There can be only one Detail Start element, and it must be
inside the document's root element. Each band of the DataWindow
is wrapped by a &lt;div&gt; element. When the DataWindow
is exported in XHTML, this element and all children and/or
siblings after it are generated iteratively for each row.</p>
<A NAME="TI1887"></A><h3>Header section</h3>
<A NAME="TI1888"></A><p>The Header section can contain the items listed in <A HREF="dwprgugp47.htm#CIHJFGHF">Table 6-12</A>. Only the root XHTML &lt;form&gt; element
is required:</p>
<A NAME="CIHJFGHF"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 6-12: Items permitted in the Header
section of an XHTML document</caption>
<tr><th  rowspan="1"  ><A NAME="TI1889"></A>Item</th>
<th  rowspan="1"  ><A NAME="TI1890"></A>Details</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1891"></A>Root &lt;form&gt; element (start
tag)</td>
<td  rowspan="1"  ><A NAME="TI1892"></A>The XHTML &lt;form&gt; element
is the root element of the XHTML template. See <A HREF="dwprgugp47.htm#BABCHDIA">"Root element"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1893"></A>XHTML elements</td>
<td  rowspan="1"  ><A NAME="TI1894"></A>Additional elements below the root element.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1895"></A>DataWindow control references</td>
<td  rowspan="1"  ><A NAME="TI1896"></A>Text. See <A HREF="dwprgugp47.htm#CIHEFJGA">"DataWindow controls"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1897"></A>DataWindow expressions</td>
<td  rowspan="1"  ><A NAME="TI1898"></A>Text. See <A HREF="dwprgugp47.htm#BJFEIJIE">"DataWindow expressions"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1899"></A>Literal text</td>
<td  rowspan="1"  ><A NAME="TI1900"></A>Text that does not correspond to a DW
control.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1901"></A>Attributes</td>
<td  rowspan="1"  ><A NAME="TI1902"></A>Can be assigned to all elements. See <A HREF="dwprgugp47.htm#BJFIEGAA">"Element attributes"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1903"></A>CDATA sections</td>
<td  rowspan="1"  ><A NAME="TI1904"></A>See <A HREF="dwprgugp47.htm#CIHCEACF">"CDATA sections"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1905"></A>Child elements</td>
<td  rowspan="1"  ><A NAME="TI1906"></A>Child elements in the Header section
cannot be iterative except for the Group DataWindow.</td>
</tr>
</table>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Detail section in root element</span> <A NAME="TI1907"></A>The root element displays in the Header section, but the entire
content of the Detail section is contained in the root element.</p>
<A NAME="TI1908"></A><p>The items in the Header section are generated only once at
runtime (when the DataWindow is exported to XHTML), unless the DataWindow
is a Group DataWindow. For Group DataWindows, the corresponding
XHTML fragment in the Header section is repeated so that it iteratively
heads each group detail&#8212;the group of XHTML rows corresponding
to the group specified in the DataWindow.</p>
<A NAME="TI1909"></A><p>The Header section contains the rendering of the DataWindow
header band and any group header bands. Bands are generated within &lt;div&gt; elements.
The controls rendered in the Header section (such as computed titles
and text control column headings) are typically also generated within &lt;div&gt; elements, with
referenced content.</p>
<A NAME="TI1910"></A><p>These entities are generated only once and are not iterated
for each row. However, for DataWindows with group headers, the corresponding
XHTML fragment in the Header section is repeated, iteratively heading
each group of XHTML rows corresponding to the group specified in
the DataWindow.</p>
<A NAME="TI1911"></A><h3>Detail section</h3>
<A NAME="TI1912"></A><p>The Detail section contains the rendering of the DataWindow
Detail band, delimited by the first &lt;div&gt; element.
The &lt;div&gt; element's contents represent
a single row instance to be generated iteratively. Any group trailers,
summary band, and footer band are also appended and enclosed by &lt;div&gt; elements.
The controls rendered in the Detail section (for example, column,
computed field, DropDownDataWindow, DropDownListBox, checkbox, and
button controls) are usually also generated within &lt;div&gt;, &lt;input&gt;,
or &lt;select&gt; elements with referenced content.</p>
<A NAME="TI1913"></A><p>The Detail section can contain the items listed in <A HREF="dwprgugp47.htm#CIHCEFIF">Table 6-13</A>.</p>
<A NAME="CIHCEFIF"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 6-13: Items permitted in the Detail
section of an XHTML document</caption>
<tr><th  rowspan="1"  ><A NAME="TI1914"></A>Item</th>
<th  rowspan="1"  ><A NAME="TI1915"></A>Details</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1916"></A>First &lt;div&gt; element</td>
<td  rowspan="1"  ><A NAME="TI1917"></A>The contents of the &lt;div&gt; element
represent a single row instance to be generated iteratively.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1918"></A>XHTML elements</td>
<td  rowspan="1"  ><A NAME="TI1919"></A>Additional elements below the root element.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1920"></A>DataWindow control references</td>
<td  rowspan="1"  ><A NAME="TI1921"></A>Text. See <A HREF="dwprgugp47.htm#CIHEFJGA">"DataWindow controls"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1922"></A>DataWindow expressions</td>
<td  rowspan="1"  ><A NAME="TI1923"></A>Text. See <A HREF="dwprgugp47.htm#BJFEIJIE">"DataWindow expressions"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1924"></A>Literal text</td>
<td  rowspan="1"  ><A NAME="TI1925"></A>Text that does not correspond to a DW
control.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1926"></A>Attributes</td>
<td  rowspan="1"  ><A NAME="TI1927"></A>Can be assigned to all elements. See <A HREF="dwprgugp47.htm#BJFIEGAA">"Element attributes"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1928"></A>CDATA sections</td>
<td  rowspan="1"  ><A NAME="TI1929"></A>See <A HREF="dwprgugp47.htm#CIHCEACF">"CDATA sections"</A>.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1930"></A>Child elements</td>
<td  rowspan="1"  ><A NAME="TI1931"></A>Child elements in the Header section
cannot be iterative except in the case of group DataWindows.</td>
</tr>
</table>
<A NAME="TI1932"></A><h2>Editing XHTML export templates</h2>
<A NAME="TI1933"></A><p>Every
item in the Export Template view for XHTML has a pop-up menu for modifying
the structural layout of the XHTML document that will be generated at
runtime. Using the pop-up menu, you can perform actions appropriate
to that item, such as editing or deleting the item, adding or editing
attributes, adding child elements or other items, and inserting
elements, CDATA sections, and so forth, before the current item.</p>
<br><img src="images/menu1.gif">
<A NAME="TI1934"></A><p>If an element has no attributes, you can edit its tag in the
Export Template view for XHTML by selecting it and left-clicking
the tag or pressing F2. Literal text nodes can be edited in the
same way. You can delete items (and their children) by pressing
the Delete key. </p>
<A NAME="BABCHDIA"></A><h3>Root element</h3>
<A NAME="TI1935"></A><p>The root element of the XHTML export template is the XHTML &lt;form&gt; element.
You can change the name of the root element and add attributes and children.</p>
<br><img src="images/rootelem.gif">
<A NAME="TI1936"></A><p>Changing the name of the root element changes the name of
its start and end tags. You can change the name using the Edit Attributes
menu item to display the Element Attributes dialog box. For information
about editing attributes, see <A HREF="dwprgugp47.htm#BJFIEGAA">"Element attributes"</A>.</p>
<A NAME="TI1937"></A><p>You can add the following kinds of children to the root element:<A NAME="TI1938"></A>
<ul>
<li class=fi>Elements</li>
<li class=ds>Text</li>
<li class=ds>DataWindow control references</li>
<li class=ds>DataWindow expressions (including column references)</li>
<li class=ds>CDATA sections
</li>
</ul>
</p>
<A NAME="CIHEFJGA"></A><h3>DataWindow controls</h3>
<A NAME="TI1939"></A><p>Adding a DataWindow control reference opens a dialog box containing
a list of the columns, computed fields, report controls, and text
controls in the document.</p>
<br><img src="images/dwctrlrf.gif">
<A NAME="TI1940"></A><p>Control references can also be added to empty attribute values
or element contents using drag and drop from the Control List view.
Column references can also be added using drag-and-drop from the
Column Specifications view.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Drag-and-drop cannot replace</span> <A NAME="TI1941"></A>You cannot drag-and-drop an item on top of another item to
replace it. For example, if you want to replace one control reference
with another control reference, or with a DataWindow expression,
you first need to delete the control reference you want to replace.</p>
<A NAME="BJFEIJIE"></A><h3>DataWindow expressions</h3>
<A NAME="TI1942"></A><p>Adding a DataWindow expression using the Add Child&gt;DataWindow
Control Reference menu item opens the Modify Expression dialog box.
This enables you to create references to columns from the data source
of the DataWindow object. It also enables the calling of global
functions. One use of this feature is to return a fragment of XHTML
to embed, providing another level of dynamic XHTML generation.</p>
<A NAME="TI1943"></A><h4>Using Date and DateTime with strings</h4>
<A NAME="TI1944"></A><p>If you use a control reference or a DataWindow expression
that does not include a string to represent Date and DateTime columns
in a template, the XHTML output conforms to ISO 8601 date and time
formats. For example, consider a date that displays as <FONT FACE="Courier New">12/27/2002 </FONT>in
the DataWindow, using the display format <FONT FACE="Courier New">mm/dd/yyyy</FONT>.
If the export template does not use an expression that includes
a string, the date is exported to XHTML as <FONT FACE="Courier New">2002-12-27</FONT>.</p>
<A NAME="TI1945"></A><p>However, if the export template uses an expression that combines
a column with a Date or DateTime datatype with a string, the entire
expression is exported as a string and the regional settings in
the Windows registry are used to format the date and time. </p>
<A NAME="TI1946"></A><p>Using the previous example, if the short date format in the
registry is <FONT FACE="Courier New">mm/dd/yy</FONT>,
and the DataWindow expression is: <FONT FACE="Courier New">"Start Date
is " + start_date</FONT>, the XHTML
output is <FONT FACE="Courier New">Start Date is 12/27/02</FONT>.</p>
<A NAME="BJFIEGAA"></A><h3>Element attributes</h3>
<A NAME="TI1947"></A><p>Select Edit Attributes from the pop-up menu for elements to
edit an existing attribute or add a new one. The attributes that
display include all the default attributes for the elements with
any template changes applied. The name attribute (and in some cases
the class attribute) used to identify the element is omitted and
cannot be changed.</p>
<br><img src="images/xmlattr1.gif">
<A NAME="TI1948"></A><p>You can change or delete the default attribute values or add
new ones. Controls or expressions can also be referenced for element
attribute values.</p>
<A NAME="TI1949"></A><p>For each attribute specified, you can select a control reference
from the drop-down list or enter a literal text value.
A literal text value takes precedence over a control reference.
You can also use the expression button to the right of the Text
box to enter an expression.</p>
<A NAME="TI1950"></A><p>The expression button and entry operates similarly to DataWindow
object properties in the Properties view. The button shows a green
equals sign if an expression has been entered, and a red not-equals
sign if not. A control reference or text value specified in addition
to the expression is treated as a default value. In the template,
this combination is stored with the control reference or text value,
followed by a tab, preceding the expression. For example:<p><PRE><i>attribute_name</i>=~"<i>text_val</i>~~t<i>dw_expression</i>~"</PRE></p>
</p>
<A NAME="TI1951"></A><p>When you finish modifying element attributes and you click
OK, only changes are stored in the template. Default attributes
that are deleted are added in the template and marked with an empty
value.</p>
<A NAME="TI1952"></A><h3>Style declarations</h3>
<A NAME="TI1953"></A><p>If you right-click an element and select Edit Styles from
the pop-up menu, the Style Declarations dialog box displays the
read-only set of default style declarations for the element on the
left: </p>
<br><img src="images/styledec.gif">
<A NAME="TI1954"></A><p>For clarity, style declarations are omitted from the XHTML
export template. You can add new style declarations or override
the existing ones by declaring them on the right side, or remove
them by adding them with an empty value.</p>
<A NAME="TI1955"></A><h3>JavaScript event handlers</h3>
<A NAME="TI1956"></A><p>If you right-click an element and select Edit Events from
the pop-up menu, the JavaScript Event Handlers dialog box displays
a read-only set of event handlers for the element on the left: </p>
<br><img src="images/jsevnthn.gif">
<A NAME="TI1957"></A><p>This dialog displays the current JavaScript event handlers,
if any. You can add new event handlers or override the existing
ones by declaring them on the right side, or remove them by adding
them with an empty value.</p>
<A NAME="CIHCEACF"></A><h3>CDATA sections</h3>
<A NAME="TI1958"></A><p>Everything inside a CDATA section is ignored by the parser.
If text contains characters such as less than or greater than signs
(&lt; or &gt;) or ampersands (&amp;) that are significant
to the parser, it should be defined as a CDATA section. A CDATA
section starts with <FONT FACE="Courier New">&lt;![CDATA[</FONT> and
ends with <FONT FACE="Courier New">]]&gt;</FONT>.
CDATA sections cannot be nested, and there can be no white space
characters inside the <FONT FACE="Courier New">]]&gt;</FONT> delimiter&#8212;for
example, you cannot put a space between the two square brackets.</p>
<A NAME="TI1959"></A><h4>Example</h4>
<A NAME="TI1960"></A><p><p><PRE> &lt;![CDATA[<br>   do not parse me<br>]]&gt;</PRE></p>
<A NAME="TI1961"></A><h3>Element Context Menus</h3>
<A NAME="TI1962"></A><p>The tree view in the Export Template view for XHTML represents
a real-time DOM tree. Each XHTML element of the tree in the Header
and Detail sections has a pop-up menu. The pop-up menu items perform
DOM-based actions for modifying the structural layout of the XHTML
document that will be generated. The menu options include:</p>
<A NAME="TI1963"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><th  rowspan="1"  ><A NAME="TI1964"></A>Menu item</th>
<th  rowspan="1"  ><A NAME="TI1965"></A>DOM-based action</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1966"></A>Edit</td>
<td  rowspan="1"  ><A NAME="TI1967"></A>DOMNode::SetNodeName</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1968"></A>Add Child</td>
<td  rowspan="1"  ><A NAME="TI1969"></A>DOMNode::AppendChild</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1970"></A>Insert Before</td>
<td  rowspan="1"  ><A NAME="TI1971"></A>DOMNode::InsertBefore</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1972"></A>Delete</td>
<td  rowspan="1"  ><A NAME="TI1973"></A>DOMNode::RemoveChild</td>
</tr>
</table>
<A NAME="TI1974"></A><h4>DOM-based actions</h4>
<A NAME="TI1975"></A><p>Edit allows changing the label of the tree view item representing
the XHTML element name. All element items that display no attributes,
as well as literal text nodes selected in the tree view, can also
be edited with a single mouse-click or with the shortcut
key F2. Add Child allows appending an entity as a last child. The
submenu option DataWindow Control Reference invokes a dialog containing
a filtered list box of Column, Computed Field, and Text controls
for user selection. Control references can also be added to empty attribute
values or element contents using drag-and-drop from the existing Control
List View. DataWindow Expressions can also be added using the existing
dialog. DataWindow column references (in the form of expressions) can
also be added using drag-and-drop from the Column Specification
View. Tree view items, except the &lt;form&gt; element,
can also be deleted with the Delete key.</p>
<A NAME="TI1976"></A><h4>Presentation and function</h4>
<A NAME="TI1977"></A><p>The remaining context menu items invoke dialogs that allow
overriding presentational and functional specifications of each
element. These include:<A NAME="TI1978"></A>
<ul>
<li class=fi>Style declarations</li>
<li class=ds>Element attributes</li>
<li class=ds>JavaScript event handlers
</li>
</ul>
</p>
<A NAME="TI1979"></A><p>The dialogs first display these specifications as they would
be generated at runtime by default. The painter gets these from
the XML Web Generator in DWE in real-time, read-only display on
one half of the dialog. Within input field(s) on the other half
of the dialog, the developer can override these specifications at
the atomic declaration or attribute level. This includes resetting
included declarations/attributes, setting declarations/attributes
not included, or removing declarations/attributes. These
change specifications will then persist in the XHTML export template,
and be applied to the default presentation generated by the XML
Web Generator at runtime.</p>
<A NAME="CIHJJHCH"></A><h2>Selecting XHTML export templates at runtime</h2>
<A NAME="TI1980"></A><p>Two DataWindow properties, Export.XHTML.TemplateCount and Export.XHTML.Template[ ].Name,
enable you to provide a list of templates from which the user of
the application can select at runtime.</p>
<A NAME="TI1981"></A><p>The TemplateCount property gets the number of templates associated
with a DataWindow object. You can use this number as the upper limit
in a <b>FOR</b> loop that populates a drop-down list
with the template names. The <b>FOR</b> loop uses the
Template[ ].Name property.<p><PRE> string ls_template_count, ls_template_name<br>long i<br> <br>ls_template_count=dw_1.Describe<br>  ("DataWindow.Export.XHTML.TemplateCount")<br> <br>for i=1 to Long(ls_template_count)<br>  ls_template_name=<br>  dw_1.Object.DataWindow.Export.XHTML.Template[i].Name<br>  ddlb_1.AddItem(ls_template_name)<br>next</PRE></p>
<A NAME="TI1982"></A><p>Before generating the XHTML, set the export template using
the text in the drop-down list box:<p><PRE> dw_1.Object.DataWindow.Export.XHTML.UseTemplate=<br>   ddlb_1.text</PRE></p>
<A NAME="TI1983"></A><h2>Exporting the DataWindow Web form in XML and XSLT
or in XHTML</h2>
<A NAME="TI1984"></A><h4>Exporting in XML <br>and XSLT</h4>
<A NAME="TI1985"></A><p>You can export the DataWindow or DataStore object in XML and
XSLT using PowerScript dot notation or the <b>Describe</b> method:<p><PRE> ls_xmlstring = dw_1.Object.DataWindow.Data.XMLWeb<br>ls_xmlstring = dw_1.Describe("DataWindow.Data.XMLWeb")</PRE></p>
<A NAME="TI1986"></A><p>When you export the DataWindow or DataStore object, PowerBuilder
uses an export template to specify the content of the generated
XSLT and CSS style sheets.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Default export format</span> <A NAME="TI1987"></A>If you have not created or assigned an export template, PowerBuilder
uses the default XSLT export format. This is the same format used
when you create a new default export template. See <A HREF="dwprgugp47.htm#CHDBIFAA">"Creating and saving templates"</A>. </p>
<A NAME="TI1988"></A><h4>Exporting in XHTML</h4>
<A NAME="TI1989"></A><p>You can export the DataWindow or DataStore object in XHTML
using PowerScript dot notation or the <b>Describe</b> method:<p><PRE> ls_xmlstring = dw_1.Object.DataWindow.Data.XHTML<br>ls_xmlstring = dw_1.Describe("DataWindow.Data.XHTML")</PRE></p>
<A NAME="TI1990"></A><p>When you export the DataWindow or DataStore object, PowerBuilder
uses an export template to specify the content of the generated
XHTML and CSS style sheet.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Default export format</span> <A NAME="TI1991"></A>If you have not created or assigned an export template, PowerBuilder
uses the default XHTML export format. This is the same format used
when you create a new default export template. See <A HREF="dwprgugp47.htm#CHDBIFAA">"Creating and saving templates"</A> on <br>page <A HREF="dwprgugp47.htm#CHDBIFAA"></A>. </p>

